﻿#if WinRT //stub
using System;
using System.Globalization;

namespace System
{
    public interface IConvertible
    {

        /// <summary>
        /// Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A Boolean value equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        bool ToBoolean(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A Unicode character equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        char ToChar(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 8-bit signed integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        sbyte ToSByte(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 8-bit unsigned integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        byte ToByte(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 16-bit signed integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        short ToInt16(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 16-bit unsigned integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        ushort ToUInt16(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 32-bit signed integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        int ToInt32(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 32-bit unsigned integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        uint ToUInt32(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 64-bit signed integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        long ToInt64(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An 64-bit unsigned integer equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        ulong ToUInt64(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A single-precision floating-point number equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        float ToSingle(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A double-precision floating-point number equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        double ToDouble(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent <see cref="T:System.Decimal"/> number using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A <see cref="T:System.Decimal"/> number equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        Decimal ToDecimal(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent <see cref="T:System.DateTime"/> using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A <see cref="T:System.DateTime"/> instance equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        DateTime ToDateTime(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an equivalent <see cref="T:System.String"/> using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// A <see cref="T:System.String"/> instance equivalent to the value of this instance.
        /// </returns>
        /// <param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        string ToString(IFormatProvider provider);

        /// <summary>
        /// Converts the value of this instance to an <see cref="T:System.Object"/> of the specified <see cref="T:System.Type"/> that has an equivalent value, using the specified culture-specific formatting information.
        /// </summary>
        /// 
        /// <returns>
        /// An <see cref="T:System.Object"/> instance of type <paramref name="conversionType"/> whose value is equivalent to the value of this instance.
        /// </returns>
        /// <param name="conversionType">The <see cref="T:System.Type"/> to which the value of this instance is converted. </param><param name="provider">An <see cref="T:System.IFormatProvider"/> interface implementation that supplies culture-specific formatting information. </param>
        object ToType(Type conversionType, IFormatProvider provider);
    }
}
namespace System.ComponentModel
{
    /// <summary>
    /// Specifies what type to use as a converter for the object this attribute is bound to.
    /// </summary>
    [AttributeUsage(AttributeTargets.All)]
    public sealed class TypeConverterAttribute : Attribute
    {
        /// <summary>
        /// Specifies the type to use as a converter for the object this attribute is bound to.
        /// </summary>
        public static readonly TypeConverterAttribute Default = new TypeConverterAttribute();
        private string typeName;

        /// <summary>
        /// Gets the fully qualified type name of the <see cref="T:System.Type"/> to use as a converter for the object this attribute is bound to.
        /// </summary>
        /// 
        /// <returns>
        /// The fully qualified type name of the <see cref="T:System.Type"/> to use as a converter for the object this attribute is bound to, or an empty string ("") if none exists. The default value is an empty string ("").
        /// </returns>
        public string ConverterTypeName
        {
            get
            {
                return this.typeName;
            }
        }

        static TypeConverterAttribute()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.ComponentModel.TypeConverterAttribute"/> class with the default type converter, which is an empty string ("").
        /// </summary>
        public TypeConverterAttribute()
        {
            this.typeName = string.Empty;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.ComponentModel.TypeConverterAttribute"/> class, using the specified type as the data converter for the object this attribute is bound to.
        /// </summary>
        /// <param name="type">A <see cref="T:System.Type"/> that represents the type of the converter class to use for data conversion for the object this attribute is bound to. </param>
        public TypeConverterAttribute(Type type)
        {
            this.typeName = type.AssemblyQualifiedName;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.ComponentModel.TypeConverterAttribute"/> class, using the specified type name as the data converter for the object this attribute is bound to.
        /// </summary>
        /// <param name="typeName">The fully qualified name of the class to use for data conversion for the object this attribute is bound to. </param>
        public TypeConverterAttribute(string typeName)
        {
            typeName.ToUpper();
            this.typeName = typeName;
        }

        /// <summary>
        /// Returns whether the value of the given object is equal to the current <see cref="T:System.ComponentModel.TypeConverterAttribute"/>.
        /// </summary>
        /// 
        /// <returns>
        /// true if the value of the given object is equal to that of the current <see cref="T:System.ComponentModel.TypeConverterAttribute"/>; otherwise, false.
        /// </returns>
        /// <param name="obj">The object to test the value equality of. </param>
        public override bool Equals(object obj)
        {
            TypeConverterAttribute converterAttribute = obj as TypeConverterAttribute;
            if (converterAttribute != null)
                return converterAttribute.ConverterTypeName == this.typeName;
            else
                return false;
        }

        /// <summary>
        /// Returns the hash code for this instance.
        /// </summary>
        /// 
        /// <returns>
        /// A hash code for the current <see cref="T:System.ComponentModel.TypeConverterAttribute"/>.
        /// </returns>
        public override int GetHashCode()
        {
            return this.typeName.GetHashCode();
        }
    }
    public interface ITypeDescriptorContext
    {
    }

    /// <summary>
    /// Provides a unified way of converting types of values to other types. <see cref="T:System.ComponentModel.TypeConverter"/> typically supports string-to-object conversion, either for property editors in design environments, or to enable XAML usages.
    /// </summary>
    public class TypeConverter
    {
        /// <summary>
        /// Returns whether the type converter can convert an object from the specified type to the type of this converter.
        /// </summary>
        /// 
        /// <returns>
        /// true if this converter can perform the conversion; otherwise, false.
        /// </returns>
        /// <param name="sourceType">The type you want to convert from.</param>
        public bool CanConvertFrom(Type sourceType)
        {
            return this.CanConvertFrom((ITypeDescriptorContext) null, sourceType);
        }

        /// <summary>
        /// Returns whether the type converter can convert an object from the specified type to the type of this converter.
        /// </summary>
        /// 
        /// <returns>
        /// true if this converter can perform the conversion; otherwise, false.
        /// </returns>
        /// <param name="context">An object that provides a format context.</param><param name="sourceType">The type you want to convert from.</param>
        public virtual bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            return false;
        }

        /// <summary>
        /// Returns whether the type converter can convert an object to the specified type.
        /// </summary>
        /// 
        /// <returns>
        /// true if this converter can perform the conversion; otherwise, false.
        /// </returns>
        /// <param name="destinationType">The type you want to convert to.</param>
        public bool CanConvertTo(Type destinationType)
        {
            return this.CanConvertTo((ITypeDescriptorContext) null, destinationType);
        }

        /// <summary>
        /// Returns whether the type converter can convert an object to the specified type.
        /// </summary>
        /// 
        /// <returns>
        /// true if this converter can perform the conversion; otherwise, false.
        /// </returns>
        /// <param name="context">An object that provides a format context.</param><param name="destinationType">The type you want to convert to.</param>
        public virtual bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            return false;
        }

        /// <summary>
        /// Converts from the specified value to the type of this converter.
        /// </summary>
        /// 
        /// <returns>
        /// The converted value.
        /// </returns>
        /// <param name="value">The value to convert to the type of this converter.</param>
        public object ConvertFrom(object value)
        {
            return this.ConvertFrom((ITypeDescriptorContext) null, CultureInfo.CurrentCulture, value);
        }

        /// <summary>
        /// Converts from the specified value to the intended conversion type of the converter.
        /// </summary>
        /// 
        /// <returns>
        /// The converted value.
        /// </returns>
        /// <param name="context">An object that provides a format context. </param><param name="culture">The <see cref="T:System.Globalization.CultureInfo"/> to use as the current culture. </param><param name="value">The value to convert to the type of this converter.</param><exception cref="T:System.NotImplementedException"><see cref="M:System.ComponentModel.TypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object)"/> not implemented in base <see cref="T:System.ComponentModel.TypeConverter"/>.</exception>
        public virtual object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            throw new NotImplementedException("ConvertFrom not implemented in base TypeConverter.");
        }

        /// <summary>
        /// Converts the specified text to an object.
        /// </summary>
        /// 
        /// <returns>
        /// An object that represents the converted text string.
        /// </returns>
        /// <param name="text">The text representation of the object to convert.</param>
        public object ConvertFromString(string text)
        {
            return this.ConvertFrom((ITypeDescriptorContext) null, (CultureInfo) null, (object) text);
        }

        /// <summary>
        /// Converts the specified value object to the specified type.
        /// </summary>
        /// 
        /// <returns>
        /// The converted object.
        /// </returns>
        /// <param name="context">An object that provides a format context. </param><param name="culture">The <see cref="T:System.Globalization.CultureInfo"/> to use as the current culture. </param><param name="value">The object to convert.</param><param name="destinationType">The type to convert the object to.</param><exception cref="T:System.NotImplementedException"><see cref="M:System.ComponentModel.TypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object,System.Type)"/>  not implemented in base <see cref="T:System.ComponentModel.TypeConverter"/>.</exception>
        public virtual object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value,
                                        Type destinationType)
        {
            throw new NotImplementedException("ConvertTo not implemented in base TypeConverter.");
        }

        /// <summary>
        /// Converts the specified value object to the specified type.
        /// </summary>
        /// 
        /// <returns>
        /// The converted object.
        /// </returns>
        /// <param name="value">The object to convert.</param><param name="destinationType">The type to convert the object to.</param>
        public object ConvertTo(object value, Type destinationType)
        {
            return this.ConvertTo((ITypeDescriptorContext) null, CultureInfo.CurrentCulture, value, destinationType);
        }

        /// <summary>
        /// Converts the specified object to a string representation.
        /// </summary>
        /// 
        /// <returns>
        /// An object that represents the converted value.
        /// </returns>
        /// <param name="value">The object to convert</param>
        public string ConvertToString(object value)
        {
            return
                (string)
                this.ConvertTo((ITypeDescriptorContext) null, CultureInfo.CurrentCulture, value, typeof (string));
        }
    }
}

#endif